/*
    XTU OJ: 1319
    Input generation
    by: fifth_light
*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
    int seed;
    sscanf(argv[1], "%d", &seed);
    srand(seed);

    int prime_table[100050] = {1, 1, 0};
    for (int i = 2; i < 317; (i == 2) ? (i++) : (i += 2)) {
        for (int j = i * 2; j < 100050; j += i) {
            prime_table[j] = 1;
        }
    }
    
    int prime_count = 0;
    int primes[100050] = {0};
    for (int i = 2; i < 100050; i++) {
        if (prime_table[i] == 0) {
            primes[prime_count++] = i;
        }
    }

    int nums_count = 0;
    int num_list[300];
    for (int j = 2; j < 100050; j++) {
        int a = j;
        int nums[10][2] = {0};
        int num = 0;
        int all = 0;
        for (int i = 0; i < prime_count; i++) {
            int prime = primes[i];
            int hit = 0;
            int exit = 0;
            while (a % prime == 0) {
                hit = 1;
                a /= prime;
                all++;
                nums[num][1]++;
                if (all == 10) {
                    goto next_num;
                }
                if (a == 1) {
                    exit = 1;
                }
            }
            if (hit) {
                nums[num][0] = prime;
                num++;
            }
            if (exit == 1) {
                break;
            }
        }
        int count = 1;
        for (int i = 0; i < num; i++) {
            count *= nums[i][1] + 1;
        }
        if (count == 3 || count == 5) {
            num_list[nums_count++] = j;
        }
        next_num:;
    }
    puts("10");
    for (int i = 0; i < 10; i++) {
        puts("10");
        for (int j = 0; j < 10; j++) {
            int index = rand() % nums_count;
            printf("%d ", num_list[index]);
        }
        putchar('\n');
    }
    return 0;
}
